﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SLControlLibrary.Resources.Controls.Calendar.Common;

namespace SLControlLibrary.Resources.Controls.Calendar
{
    public class ucCalendarImage : Control
    {
        #region Dependency Variables
        public static DependencyProperty DescProperty = DependencyProperty.Register("Desc", typeof(string), typeof(ucCalendarImage), new PropertyMetadata(null));
        public static DependencyProperty ShortDescProperty = DependencyProperty.Register("ShortDesc", typeof(string), typeof(ucCalendarImage), new PropertyMetadata(null));
        public static DependencyProperty LongDescProperty = DependencyProperty.Register("LongDesc", typeof(string), typeof(ucCalendarImage), new PropertyMetadata(null)); 
        #endregion

        #region Dependency Properties
        public string Desc
        {
            get { return (string)this.GetValue(DescProperty); }
            set { SetValue(DescProperty, value); }
        }
        public string ShortDesc
        {
            get { return (string)this.GetValue(ShortDescProperty); }
            set { SetValue(ShortDescProperty, value); }
        }
        public string LongDesc
        {
            get { return (string)this.GetValue(LongDescProperty); }
            set { SetValue(LongDescProperty, value); }
        }
        #endregion 

        #region Variables
        private Enumerations.BaseDescToUse _DescToUse = Enumerations.BaseDescToUse.Default;
        #endregion

        #region Properties
        public Enumerations.BaseDescToUse DescToUse
        {
            get { return _DescToUse; }
            set 
            {
                _DescToUse = value;

                switch (value)
                {
                    case Enumerations.BaseDescToUse.Default:
                        Desc = Desc;
                        break;
                    case Enumerations.BaseDescToUse.Short:
                        Desc = ShortDesc;
                        break;
                    case Enumerations.BaseDescToUse.Long:
                        Desc = LongDesc;
                        break;
                }
            }
        }
        public Enumerations.DisplayMode DisplayMode { get; set; }
        public bool MouseCaptured { get; set; }
        #endregion

        #region Constructor
        public ucCalendarImage()
        {
            DefaultStyleKey = typeof(ucCalendarImage);
        }
        #endregion

        #region Events
        #region OnMouseEnter
        protected override void OnMouseEnter(MouseEventArgs e)
        {
            base.OnMouseEnter(e);

            if (DisplayMode == Enumerations.DisplayMode.Selection)
                this.Background = new SolidColorBrush(Colors.Cyan);
        }
        #endregion

        #region OnMouseLeave
        protected override void OnMouseLeave(MouseEventArgs e)
        {
            base.OnMouseLeave(e);

            if (DisplayMode == Enumerations.DisplayMode.Selection)
                this.Background = new SolidColorBrush(Colors.White);
        }
        #endregion
        #endregion
    }
}
